#include "dialog.h"
#include "ui_dialog.h"

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
    db = QSqlDatabase::addDatabase("QPSQL");
    db.setDatabaseName("postgres");
    db.setHostName("localhost");
    db.setUserName("postgres");
    db.setPassword("123456");

    db.open();

    this->model = new QSqlQueryModel;
    model->setQuery("select id, username, password,password_salt from users");
    ui->tableView->setModel(model);

}

Dialog::~Dialog()
{
    db.close();
    delete ui;
}
